home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
BASIC
/
LIB
/
EVENTSHELL
/
DOCS
/
Draw
< prev
next >
Wrap
Text File
|
1996-04-19
|
14KB
|
554 lines
Draw units
The units used by the DrawLib routines can
be specified in several different units.
Choosing units can be achieved with the
following calls :
PROCshell_DrawSetUnitsMM millimeters
PROCshell_DrawSetUnitsCM centimeters
PROCshell_DrawSetUnitsIN inches
PROCshell_DrawSetUnitsOS OS units
PROCshell_DrawSetUnitsPT points
Drawfiles are created in millimeters by
default.
--------------------------------------------------------
PROCshell_DrawCreateFile
=> int address of drawfile buffer
(contents ignored on entry)
<= address of drawfile buffer is
updated
The drawfile is created in a RAM buffer,
the address of which is returned by the
routine. As objects are added to the file
the address of the buffer may change.
At any time the buffer contains a valid
drawfile that can be displayed with
PROCshell_DrawRenderFile.
Multiple drawfiles can be created at the
same time, adding objects to a particular
drawfile is achieved by specifying the
buffer address.
--------------------------------------------------------
PROCshell_DrawRenderFile()
=> int address of drawfile buffer
int x coordinate to render drawfile
(os units)
int y coordinate to render drawfile
(os units)
int address of wimp redraw block
bool bounding box flag (TRUE to show object
bounds, otherwise FALSE)
This routine renders (plots) a drawfile which must
be loaded into a buffer using PROCshell_DrawLoadFile,
or created by the user application with
PROCshell_DrawCreateFile.
The drawfile is always plotted relative to the current
graphics origin. The scale of the drawfile can be set
using PROCshell_DrawSetScale beforehand. Loading or
creating a new file sets the scale to 1:1.
Actual rendering is performed by the DrawFile module
which must be loaded by the application's !Run file.
Wimp redraw block
0 Window handle
4 Visible area minx (incl)
8 miny (incl)
12 maxx (excl)
16 maxy (excl)
20 Scrollx
24 Scrolly
28 Redraw rect minx (incl)
32 miny (incl)
36 maxx (excl)
40 maxy (excl)
Example Code (DrawRenderFile)
To render a drawfile during a call to a user redraw
function, no bounding boxes shown:
DEF FN_UserRedraw_Mainw(blk%,x%,y%)
PROCshell_DrawRenderFile(buffer%,x%+0,y%-1000,
,blk%,FALSE)
=0
--------------------------------------------------------
FNshell_DrawLoadFile()
=> str file name
<= int address of drawfile buffer
--------------------------------------------------------
PROCshell_DrawSaveFile()
=> int address of drawfile buffer
str file name
This routine saves the drawfile and sets
the filetype to &AFF (draw).
--------------------------------------------------------
FNshell_DrawGetFileSize()
=> int address of drawfile buffer
<= int file size in bytes (excluding
EvntShell pre-header)
--------------------------------------------------------
PROCshell_DrawGetBoundingBox()
=> int address of drawfile buffer
int min x position
int min y position
int width
int height
bool TRUE if box coords are to be
returned in OS units, ELSE
values returned in draw units
<= The x,y,height and width values are
returned
--------------------------------------------------------
PROCshell_DrawInitFont()
=> int address of drawfile buffer
str name of font to initialise
i.e. 'Trinity.Medium.Italic'
<= address of drawfile buffer is
updated
Before text using outline fonts can be used
in a drawfile it is vital that they are
initialised using this call. Once you have
called this routine for the first time you
must continue initialising all the fonts that
will be needed before creating other objects.
It would appear (despite what the PRMs say!)
that font initialisation must occur before any
other objects are defined - that is you must
initialise any fonts directly after creating
the drawfile.
Attempting to use fonts that are not available
(has !Fonts been 'seen' by the Filer?) will
cause an error. You should also bear in mind
that using fonts that other people may not have
can cause problems as various applications
react in different ways to this situation.
--------------------------------------------------------
PROCshell_DrawSetFont()
=> int address of drawfile buffer
str name of font ("" for System Font)
Before this call can be made the font specified must be
initialised with a call to PROCshell_DrawInitFont,
otherwise an error will be generated.
All text objects created with PROCshell_DrawOutlineFont
will be in the specified font until the next call to
PROCshell_DrawSetFont.
--------------------------------------------------------
PROCshell_DrawBox()
=> int address of drawfile buffer
real x coordinate of bottom left
of box
real y coordinate of bottom left
of box
real width of box
real height of box
<= address of drawfile buffer is
updated
The coordinates and dimensions of the box
are given in the currently selected units.
--------------------------------------------------------
PROCshell_DrawCircle()
=> int address of drawfile buffer
real x coordinate of centre of
circle
real y coordinate of centre of
circle
real radius of circle
<= address of drawfile buffer is
updated
The coordinates and dimensions of the circle
are given in the currently selected units.
--------------------------------------------------------
PROCshell_DrawEllipse()
=>
int address of drawfile buffer
real x coordinate of centre of
ellipse
real y coordinate of centre of
ellipse
real major axis of ellipse
real minor axis of ellipse
<= address of drawfile buffer is
updated
The coordinates and dimensions of the ellipse
are given in the currently selected units.
--------------------------------------------------------
PROCshell_DrawLine()
=> int address of drawfile buffer
real x coordinate of start of line
real y coordinate of start of line
real x coordinate of end of line
real y coordinate of end of line
<= address of drawfile buffer is
updated
The coordinates and dimensions of the line
are given in the currently selected units.
--------------------------------------------------------
PROCshell_DrawOutlineFont()
=> int address of drawfile buffer
str text to insert
real width of font (points)
real height of font (points)
real x coordinate of bottom left
of text (current units)
real y coordinate of bottom left
of text (current units)
<= address of drawfile buffer is
updated
Before a text object can inserted the font
used must be initialised with a call to
PROCshell_DrawInitFont, otherwise an error
will be generated. The font to use must also
be selected with PROCshell_DrawSetFont.
--------------------------------------------------------
PROCshell_DrawSetFillColour()
=> int address of drawfile buffer
int red value (0-255)
int green value (0-255)
int blue value (0-255)
The colour value is supplied as a 24 bit
value, RISC OS handles the display of the
colour by dithering. 'No colour' may be selected
by specifying the red, green, blue values as
-1, -1, -1.
--------------------------------------------------------
PROCshell_DrawSetNoFillColour
=> int address of drawfile buffer
Sets current fill colour back to transparent.
--------------------------------------------------------
PROCshell_DrawSetPathColour()
=> int address of drawfile buffer
int red value (0-255)
int green value (0-255)
int blue value (0-255)
The colour value is supplied as a 24 bit
value, RISC OS handles the display of the
colour by dithering. 'No colour' may be selected
by specifying the red, green, blue values as
-1, -1, -1.
--------------------------------------------------------
PROCshell_DrawSetPathNoColour
=> int address of drawfile buffer
Sets current path colour back to transparent.
--------------------------------------------------------
PROCshell_DrawSetPathWidth()
=> int address of drawfile buffer
real path width (current units)
--------------------------------------------------------
PROCshell_DrawSetUnitsCM()
=> int address of drawfile buffer
Sets centimeters to be the current unit of
measurement for the other library routines.
--------------------------------------------------------
PROCshell_DrawSetUnitsIN()
=> int address of drawfile buffer
Sets inches to be the current unit of
measurement for the other library routines.
--------------------------------------------------------
PROCshell_DrawSetUnitsMM()
=> int address of drawfile buffer
Sets millimeters to be the current unit of
measurement for the other library routines.
--------------------------------------------------------
PROCshell_DrawSetUnitsOS()
=> int address of drawfile buffer
Sets OS units to be the current unit of
measurement for the other library routines.
--------------------------------------------------------
PROCshell_DrawSetUnitsPT()
=> int address of drawfile buffer
Sets points to be the current unit of
measurement for the other library routines.
--------------------------------------------------------
PROCshell_DrawSetStartCapNone()
=> int buffer containing drawfile
Sets no cap at the start of the path.
--------------------------------------------------------
PROCshell_DrawSetStartCapRound()
=> int buffer containing drawfile
Sets a round cap at the start of the path.
--------------------------------------------------------
PROCshell_DrawSetStartCapSquare()
=> int buffer containing drawfile
Sets a square cap at the start of the path.
--------------------------------------------------------
PROCshell_DrawSetStartCapTriangle()
=> int buffer containing drawfile
int width of arrowhead (current units)
int length of arrowhead (current units)
Sets a triangular cap at the start of the path.
--------------------------------------------------------
PROCshell_DrawSetEndCapNone()
=> int buffer containing drawfile
Sets no cap at the end of the path.
--------------------------------------------------------
PROCshell_DrawSetEndCapRound()
=> int buffer containing drawfile
Sets a round cap at the end of the path.
--------------------------------------------------------
PROCshell_DrawSetEndCapSquare()
=> int buffer containing drawfile
Sets a square cap at the end of the path.
--------------------------------------------------------
PROCshell_DrawSetEndCapTriangle()
=> int buffer containing drawfile
int width of arrowhead (current units)
int length of arrowhead (current units)
Sets a triangular cap at the end of the path.
--------------------------------------------------------
PROCshell_DrawSetScale()
=> int address of drawfile buffer
real x scale
real y scale
Each drawfile buffer created or loaded by
the library routines has a scale which is
contained in the pre-header. Loading or
creating a new file sets the scale to 1:1.
--------------------------------------------------------
PROCshell_DrawGetScale()
=> int address of drawfile buffer
real x scale (value updated)
real y scale (value updated)
Each drawfile buffer created or loaded by
the library routines has a scale which is
contained in the pre-header. This routine
allows the currently set scales to be read.
--------------------------------------------------------
PROCshell_DrawResizeWindow()
=> int address of drawfile buffer
int window handle
int left margin (os units)
int bottom margin (os units)
int right margin (os units)
int top margin (os units)
Resizes an existing window to suit the
drawfile held in the specified buffer,
taking account of the current scale.
--------------------------------------------------------
PROCshell_DrawScaleToWindow()
=> int address of drawfile buffer
int window handle
int left margin (os units)
int bottom margin (os units)
int right margin (os units)
int top margin (os units)
real xscl (value returned)
real yscl (value returned)
Returns the scale factors required to fit
the drawfile held in the specified buffer
within the given window.
--------------------------------------------------------
PROCshell_DrawPathStart()
=> int address of drawfile buffer
real x coord
real y coord
Begins a new path object
--------------------------------------------------------
PROCshell_DrawPathDrawTo()
=> int address of drawfile buffer
real x coord
real y coord
Adds a line segment to the current path object
--------------------------------------------------------
PROCshell_DrawPathCloseLine()
=> int address of drawfile buffer
Closes the current path with a line and fills the
path with the current fill colour
--------------------------------------------------------
PROCshell_DrawPathEnd()
=> int address of drawfile buffer
Closes the current path with a gap and fills the
path with the current fill colour
--------------------------------------------------------
PROCshell_DrawStartGroup()
=> int address of drawfile buffer
str name of group (less than 12 chars)
--------------------------------------------------------
PROCshell_DrawEndGroup()
=> int address of drawfile buffer
--------------------------------------------------------
PROCshell_DrawDestroyFile()
=> int address of drawfile buffer
Removes the definition of a DrawFile and frees the
memory used.
--------------------------------------------------------
PROCshell_DrawSetPathPattern()
=> int address of drawfile buffer
bool TRUE for dashed lines, otherwise FALSE
real offset
int number of elements
real length (current units)
Sets the current path pattern (dashed etc).
--------------------------------------------------------
PROCshell_DrawSpriteArea()
=> int address of drawfile buffer (updated on return)
int area size
int address of sprite area (updated on return)
Creates a sprite area within a DrawFile buffer.
--------------------------------------------------------
PROCshell_DrawSetJoinStyleNone()
=> int buffer containing drawfile
Sets a mitred join where two paths meet.
--------------------------------------------------------
PROCshell_DrawSetJoinStyleRound()
=> int buffer containing drawfile
Sets a rounded join where two paths meet.
--------------------------------------------------------
PROCshell_DrawSetJoinStyleBevelled()
=> int buffer containing drawfile
Sets a bevelled join where two paths meet.
--------------------------------------------------------